<% include header.ejs %>
    <div id="page-wrapper">
        <div class="row">
            <div class="col-lg-12">
                <h1 class="page-header">奖励规则</h1>
            </div>
            <table id="conrige" class="table dataTable datatable_ table-striped table-bordered table-condensed">
                <thead>
                    <th>id</th>
                    <th>第一级提成费</th>
                    <th>第二级提成费</th>
                    <th>折扣次数</th>
                    <th>操作</th>
                    <!--<th>描述</th>-->
                </thead>
                <tbody>
                    <tr>
                        <td>1</td>
                        <td>0.1</td>
                        <td>0.05</td>
                        <td>3</td>
                        <td>
                            <button id="btn-change" class="btn btn-primary">修改</button>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>

    </div>
    <!-- /#page-wrapper -->

    </div>
    <!-- /#wrapper -->
    <% include footer.ejs %>

        </html>
        <script>
            $(function () {
                $('#conrige').DataTable()
                $('#btn-change').click(function () {
                    // alert(1)
                    var list = $('#conrige').find('td').not(':last').not(':first')
                    list.map(function (i, v) {
                        $(v).html("<input class='discount' type='text' value='" + $(v).text() +
                            "' />")
                    })
                    $('.discount').change(function () {
                        var list = $('#conrige').find('td').not(':last').not(':first')
                        list.map(function (i, v) {
                            $(v).html("<td>"+$(v).children().val() + "</td>")
                        })
                        alert("修改成功")
                    })
                    // var a = $('#conrige').find('td').text()
                    // $('#conrige').find('td').html("<input type='text' value='"+a+"'>")
                })
            })
        </script>